﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntityFrameworkModel;

namespace SpecificCustomersFinder
{
    class SpecificCustomersFinder
    {
        static void Main()
        {
            const string ShippedCountry = "Canada";
            const int ShippedYear = 1997;

            NorthwindEntities northwindEntities = new NorthwindEntities();
            var specificCustomers = (from customer in northwindEntities.Customers
                                    join order in northwindEntities.Orders
                                    on customer.CustomerID equals order.CustomerID
                                    where order.ShipCountry == ShippedCountry
                                    && order.ShippedDate.Value.Year == ShippedYear
                                    select customer).Distinct();
            foreach (var item in specificCustomers)
            {
                Console.WriteLine(item.CompanyName);
            }
        }
    }
}
